import React,{ Component } from "react";
import { View,Text } from "react-native";
import {load as StorageLoad} from "../../utils/StorageUtils";

export default class InTheLoad extends Component {
    constructor(props){
        super(props);
        this._bootstrapAsync();
    }
    _bootstrapAsync = async () => {
        let Token = '';
        await StorageLoad('userToken').then(res=>{
            Token = res;
        }).catch((err)=>{
            console.log(err);
        })
        console.log(Token);
        // This will switch to the App screen or Auth screen and this loading
        // screen will be unmounted and thrown away.
        this.props.navigation.navigate(Token ? 'App' : 'Auth');
    };
    render(){
        return (
            <View>
                <Text>加载中</Text>
            </View>
        )
    }
}
